<!--
  ~ The MIT License (MIT)
  ~
  ~ Copyright (c) 2019 ‭‭‭‭‭‭‭‭‭‭‭‭[smallbun] www.smallbun.org
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy of
  ~ this software and associated documentation files (the "Software"), to deal in
  ~ the Software without restriction, including without limitation the rights to
  ~ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  ~ the Software, and to permit persons to whom the Software is furnished to do so,
  ~ subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  ~ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  ~ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  ~ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  ~ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  -->

<!--suppress ALL-->
<aside class="main-sidebar">
    <section class="sidebar sidebar-collapse">
        <div class="user-panel">
            <a title="个人中心" href="javascript:void(0);"
               onclick="parent.addTabs(({id: 'profile', title: '个人中心', close: true, url:'user/profile'}))"
               data-index="0">
                <div class="hide">个人中心</div>
                <div class="pull-left image">
                    <img th:src="${user.headPortraitUrl}" class="img-circle"
                         alt="用户头像">
                </div>
            </a>
            <div class="pull-left info">
                <p sec:authentication="name"></p>
                <a href="javascript:void(0);"><i class="fa fa-circle text-success"></i> 在线</a>
                <a th:href="@{/logout}" style="padding-left:5px;"><i class="fa fa-sign-out text-danger"></i> 注销</a>
            </div>
        </div>
        <ul class="sidebar-menu tree">
            <li class="header">导航栏</li>
        </ul>
        <!--菜单 -->
        <ul class="sidebar-menu tree" id="menu" data-widget="tree" th:include="this::row(${menus})">

            <th:block th:fragment="row(menus)">
                <th:block th:each="menu : ${menus}">
                    <!--/*  如果有子元素  */-->
                    <th:block th:if="${#lists.size(menu.children)>0}">
                        <li class="treeview submenu">
                            <!--显示名称-->
                            <a href="#">
                                <i th:class="${menu.icon}"></i>
                                <span th:text="${menu.menuName}" th:style="'color: '+${menu.fontColor}+';'"></span>
                                <span class="pull-right-container">
                                    <i class="fa fa-angle-left pull-right"></i>
                                </span>
                            </a>
                            <!--/*判断子元素中是否还有子元素，递归*/-->
                            <ul class="treeview-menu" th:include="this::row(${menu.children})">
                            </ul>
                        </li>
                    </th:block>
                    <!--/*如果没有子元素*/-->
                    <th:block th:unless="${#lists.size(menu.children)}">
                        <li th:inline="javascript" class="treeview">
                            <a href="#" th:data-id="${menu.id}" th:data-title="${menu.menuName}"
                               th:data-url="${menu.url}"
                               onclick="javascript:addTabs(({obj:$(this),id:this.getAttribute('data-id'),title:this.getAttribute('data-title'),close:true,url:this.getAttribute('data-url')}))">
                                <i th:class="${menu.icon}"></i>
                                <span th:text="${menu.menuName}" th:style="'color: '+${menu.fontColor}+';'"></span>
                            </a>
                        </li>
                    </th:block>
                </th:block>
            </th:block>
        </ul>
    </section>
</aside>